const path = require('path')
const HelloWorldPlgunin = require('./plugins/HelloWorldPlguin')
const HTMLPlugin = require('./plugins/HTMLPlugin')
module.exports = {
    entry: './src/index.js',
    output: {
        path: path.join(__dirname, 'dist'),
        filename: 'bundle.js'
    },
    mode: 'development',
    module: {
        rules: [
            // 从下向上匹配loader处理，从右到左
            // {
            //     test: /\.js$/,
            //     use: './loaders/loader2.js'
            // }
            {
                test: /\.js$/,
                use: {
                    loader: './loaders/loader1.js',
                    options: {
                        name: '112'
                    }
                }
            }
            // {
            //     test: /\.js$/,
            //     use: [
            //         './loaders/loader1.js',
            //         './loaders/loader2.js'
            //     ]
            // }
        ]
    },
    plugins: [
        new HelloWorldPlgunin(),
        new HTMLPlugin({
            filename:'index.html',
            template: './src/index.html'
        })
    ]
}